package com.example.chevbook_android;

import java.util.ArrayList;
import java.util.HashMap;

import com.nostra13.universalimageloader.core.ImageLoader;

import android.content.Context;
import android.content.res.TypedArray;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Gallery;
import android.widget.ImageView;

public class ImageAdapter extends BaseAdapter {
    private int idAppart;
    private Modele vmodele = new Modele();
    private ImageLoader imageLoader = ImageLoader.getInstance();
    private Context context;
    private String[] imageUrls/*=vmodele.Recupsesphoto(idAppart)*/;
    //private Integer[] imageUrls={R.drawable.logo,R.drawable.logo};
    

 
    public ImageAdapter(Context cx,int id) {
    	context = cx;
    	idAppart=id;
    	imageUrls=vmodele.Recupsesphoto(idAppart);
    }

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return imageUrls.length;
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ImageView imageView = new ImageView(context);
		imageLoader.displayImage(imageUrls[position], imageView);
		//imageView.setImageResource(imageUrls[position]);
        return imageView;
	}

}
